package com.lzs.baseruku.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lzs.baseruku.service.OtherinService;
import com.lzs.entity.Otherin;
import com.lzs.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ymx
 * @since 2020-11-25
 */
@RestController
@RequestMapping("/baseruku/otherin")
@Api(value = "其他入库管理文档")
public class OtherinController {
    @Autowired
    private OtherinService otherinService;

    @ApiOperation(value = "查询所有其他入库信息")
    @PostMapping("/selectOtherin/{page}/{limit}")
    public R selectOtherin(@PathVariable Integer page, @PathVariable Integer limit, @RequestBody Otherin otherin){
        Page<Otherin> otherinPage = otherinService.selectreceive(page, limit, otherin);
        return R.ok().data("otherinPage",otherinPage);
    }

    @ApiOperation(value = "根据ID删除其他入库订单")
    @DeleteMapping("/deleteOtherin/{id}")
    public R deleteOtherin(@PathVariable Long id){
        boolean b = this.otherinService.removeById(id);
        if (b){
            return R.ok().message("删除成功");
        }else {
            return R.error().message("删除失败");
        }
    }
}

